<?php include_stylesheets_for_form($form) ?>
<?php include_javascripts_for_form($form) ?>

<form action="<?php echo url_for('px_personal/'.($form->getObject()->isNew() ? 'create' : 'update').(!$form->getObject()->isNew() ? '?id='.$form->getObject()->getid() : '')) ?>" method="post" <?php $form->isMultipart() and print 'enctype="multipart/form-data" ' ?>>
<?php if (!$form->getObject()->isNew()): ?>
<input type="hidden" name="sf_method" value="put" />
<?php endif; ?>
  <table>
    <tfoot>
      <tr>
        <td colspan="2">
          &nbsp;<a href="<?php echo url_for('px_personal/index?px_id='.$px_id) ?>">Cancel</a>
          <?php if (!$form->getObject()->isNew()): ?>
            &nbsp;<?php echo link_to('Delete', 'px_personal/delete?id='.$form->getObject()->getid(), array('method' => 'delete', 'confirm' => 'Are you sure?')) ?>
          <?php endif; ?>
          <input type="submit" value="Save" />
        </td>
      </tr>
    </tfoot>
    <tbody>
      <?//php echo $form ?>
    </tbody>
  </table>

		<table>

			<tfoot>
		    <tr>
		      <td colspan="2">
	     			    &nbsp;<a href="<?php echo url_for('px_personal/index?px_id='.$px_id) ?>">Cancel</a>
			          <?php if (!$form->getObject()->isNew()): ?>
			            &nbsp;<?php echo link_to('Delete', 'px_personal/delete?id='.$form->getObject()->getid(), array('method' => 'delete', 'confirm' => 'Are you sure?')) ?>
			          <?php endif; ?>
		        <input type="submit" value="Save" />
		      </td>
		    </tr>
		  </tfoot>



			<tr>
		    <td colspan="3">
			   	<?php echo $form['_csrf_token']; ?>
					<?php echo $form['id']; ?>
					<?php echo $form['person_id']; ?>
		      <?php echo $form->renderGlobalErrors() ?>
		    </td>
		  </tr>



			<tr>
				<td colspan=3>
				<table><!--Main client Info Block -->
					<tr>
			      <th><?php echo $form['px_number']->renderLabel() ?>:</th>
			      <td>
			        <?php echo $form['px_number']->renderError() ?>
			        <?php echo $form['px_number'] ?>
			      </td>
						<th><?php echo $form['sex']->renderLabel() ?>:</th>
			      <td>
			        <?php echo $form['sex']->renderError() ?>
			        <?php echo $form['sex'] ?>
			      </td>
			      <th><?php echo $form['age_to_date']->renderLabel() ?>:</th>
			      <td>
			        <?php echo $form['age_to_date']->renderError() ?>
			        <?php echo $form['age_to_date'] ?>
			      </td>
					</tr>
					<tr>
						<th><?php echo $form['birth_date']->renderLabel() ?>:</th>
			      <td>
			        <?php echo $form['birth_date']->renderError() ?>
			        <?php echo $form['birth_date'] ?>
			      </td>
			      <th><?php echo $form['birth_place']->renderLabel() ?>:</th>
			      <td>
			        <?php echo $form['birth_place']->renderError() ?>
			        <?php echo $form['birth_place'] ?>
			      </td>
					</tr>
				</table>
				</td>
			</tr>	
	
	
				<tr>

						<td valign=top><!--Phone Block column2 -->
							<fieldset>
								<legend>Banks</legend>
								<!--Show the previous entered Phones. Must find a way to enclose it into a hidden div. -->
						  <?php foreach($form['emergency_contacts'] as $formEmergencyContact): ?>
					      <?php include_partial('emergency_contact', array('form'=>$formEmergencyContact)); ?>
					    <?php endforeach; ?>
							</fieldset>
						</td>

						<td valign=top>
								<fieldset>
								<legend>Online Providers</legend>

							  <?php foreach($form['partner_familys'] as $formPartnerFamily): ?>
						      <?php include_partial('partner_family', array('form'=>$formPartnerFamily)); ?>
						    <?php endforeach; ?>

							</fieldset>

						</td>
						<td>
								<fieldset>
									<legend>Cards</legend>

								  <?php foreach($form['travel_mileages'] as $formMileage): ?>
							      <?php include_partial('travel_mileage', array('form'=>$formMileage)); ?>
							    <?php endforeach; ?>

								</fieldset>
						</td>
		</tr>


		</table>






</form>









<?php slot('submenu') ?>
<ul>
	<li><?php echo link_to(image_tag('contact info.png', array('title'=>"Contact Info", 'width'=>'65px')), 'px/show?id='.$px_id) ?></li>
	<li><?php echo link_to(image_tag('personal info.png', array('title'=>"Personal Info", 'width'=>'65px')), 'px_personal/index?px_id='.$px_id) ?></li>
	<li><?php echo link_to(image_tag('passport info.png', array('title'=>"Passport Info", 'width'=>'65px')), 'passport/index?px_id='.$px_id) ?></li>
	<li><?php echo link_to(image_tag('visa.png', array('title'=>"Visa Info", 'width'=>'65px')), 'visa/index?px_id='.$px_id) ?></li>
	<li><?php echo link_to(image_tag('other note.png', array('title'=>"Other Notes", 'width'=>'65px')), 'px_note/index?px_id='.$px_id) ?></li>
</ul>
<?php end_slot() ?>